package com.lotusfall.pojo.s2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 *
 */
@Component("stu")  // 交给Spring创建对象，就是在容器启动时创建
public class Student {
    @Value("张三")
    private String name;
    @Value("22")
    private int age;

    @Autowired
    @Qualifier("school")
    private School school;

    public Student() {
        System.out.println("无参方法调用");
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", school=" + school +
                '}';
    }
}
